import java.util.Scanner;

public class greatestCommonDivisor {
    public static void main(String[] args) {
//        453 % 36=21；
//        36 % 21=15；
//        21 % 15=6；
//        15 % 6=3；
//        6 % 3=0；
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        if(a>b) {
          int c = a;
            a = b;
            b = c;
        }
        int c = 0;
        while(true) {
            c = a%b;
            if(c==0) {
                break;
            }
            a = b;
            b = c;
        }
        System.out.println("最小公约数是："+b);

    }
}
